<?php

namespace App\Transformers;

use League\Fractal\TransformerAbstract;
use App\Models\User;

/**
 * @SWG\Definition(type="object", @SWG\Xml(name="UserTransformer"))
 */

class UserTransformer extends TransformerAbstract
{
    /**
     * @SWG\Property(format="int32")
     * @var int
     */
    public $id;

    /**
     * @SWG\Property
     * @var string
     */
    public $name;

    /**
     * @SWG\Property
     * @var string
     */
    public $mobile;

    /**
     * @SWG\Property
     * @var string
     */
    public $avatar;

    /**
     * @SWG\Property
     * @var string
     */
    public $gender;

    /**
     * @SWG\Property
     * @var string
     */
    public $address;

    /**
     * @SWG\Property
     * @var string
     */
    public $birthday;


    /**
     * @SWG\Property
     * @var string
     */
    public $self_introduce;


    /**
     * @SWG\Property
     * @var string
     */
    public $job_waiting;


    /**
     * @SWG\Property
     * @var string
     */
    public $notify;

    /**
     * @SWG\Property
     * @var string
     */
    public $shack;

    /**
     * @SWG\Property
     * @var string
     */
    public $summary;

    public function transform(User $user)
    {
        return [
            'id'=>$user['id'],
            'name' => $user['name'],
            'mobile'=> $user['mobile'],
            'avatar'=>$user['avatar'],
            'gender' => $user['gender'],
            'address' => $user['address'],
            'birthday' => $user['birthday'],
            'self_introduce'=> $user['self_introduce'],
            'job_waiting'=>$user['job_waiting'],
            'notify' => $user['notify'],
            'shack' => $user['shack'],
            'summary' => $user['summary'],
        ];
    }


}


